package xkp.lesson1;

public class TestException {
	public static void main(String[] args){
		login("123", "123");
	}
	
	public static boolean login(String name,String password){
		if(name.equals("admin")&&password.equals("123")) {
			return true;
		}else {
			//抛出一个自定义异常
			MyException exception = new MyException("用户名或密码错误");
			throw exception;
		}
	}
}
